/**
 * 
 */
package com.gragra.sequentiaDataGenerator;
import java.util.Arrays;
import com.gragra.sampling.sequentialStructure.ExtensionLevels;
import com.gragra.sampling.sequentialStructure.PunctuationType;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
/**
 * @author Christoph Teichmann
 * 01.06.2013
 */
public class PunctAssigningSegmenter implements Segmentation
{
	/**
	 * the segmenter that is wrapped to do the initial segmentation has to be given when a new instance is
	 * created
	 * @param seg
	 */
	public PunctAssigningSegmenter(Segmentation seg)
	{this.seg = seg;}
	/**
	 * the wrapped segmentation tool
	 */
	private final Segmentation seg;
	/* (non-Javadoc)
	 * @see com.gragra.sequentiaDataGenerator.Segmentation#segment(java.lang.String)
	 */
	@Override
	public ObjectArrayList<String[]> segment(String s)
	{
		ObjectArrayList<String[]> co = seg.segment(s);
		for(int i=0;i<co.size();++i)
		{
			String[] base = co.get(i);
			int l = base.length;
			base = Arrays.copyOf(base, l+2);
			base[l] = ExtensionLevels.PunctuationLevel.name();
			base[l+1] = PunctuationType.classify(base[0]).toString();
			base[0] = base[0].toLowerCase();
			co.set(i, base);
		}
		return co;
	}
}